//package com.miniprogram.common.controller;
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.miniprogram.api.service.ICustomerPermissionService;
//import com.miniprogram.bean.po.CustomerPermission;
//import com.miniprogram.bean.po.generic.DataEntity;
//import com.miniprogram.common.dto.ResponseVo;
//import com.miniprogram.common.enums.RestStatusEnum;
//import com.miniprogram.common.service.BaseService;
//import com.miniprogram.common.utils.RespUtils;
//import com.miniprogram.common.utils.Shift;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.shiro.authz.annotation.RequiresUser;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.List;
//
///**
// * <p>
// * 顾客权限表 前端控制器
// * </p>
// *
// * @author lin
// * @since 2020-04-06
// */
//@Slf4j
//public class BaseController<M extends BaseMapper<T>, T extends DataEntity> {
//
//    @Autowired
//    private M baseService;
//
//    /**
//     * 增加接口
//     */
//    @ApiOperation(value = "增加接口", notes = "增加传入相关参数", produces = "application/json, application/xml", consumes = "application/json, application/xml")
//    @PostMapping("/insert")
//    @RequiresUser
//    public ResponseVo<String> insert(T t) {
//        boolean flag = this.baseService.save(t);
//        log.info("增加{}成功，增加的id为{}", t.getClass().getSimpleName(), t.getId());
//        return new ResponseVo<>(RespUtils.respStrByBoolean(flag, "增加"));
//    }
//
//    @ApiOperation(value = "根据id全字段更新接口", notes = "必须传入对应的id以及其他所有相关字段", produces = "application/json, application/xml", consumes = "application/json, application/xml")
//    @PostMapping("/updateById")
//    @RequiresUser
//    public ResponseVo<String> updateById(T t) {
//        boolean flag = this.baseService.updateById(t);
//        log.info("更新{}成功，更新的id为{}", t.getClass().getSimpleName(), t.getId());
//        return new ResponseVo<>(RespUtils.respStrByBoolean(flag, "更新"));
//    }
//
//    @ApiOperation(value = "根据id删除接口", notes = "传入id删除对应的数据", produces = "application/json, application/xml", consumes = "application/json, application/xml")
//    @PostMapping("/deleteById")
//    @RequiresUser
//    public ResponseVo<String> deleteById(Integer id) {
//        if (id == null) {
//            Shift.fatal(RestStatusEnum.ID_NOTNULL);
//        }
//        boolean flag = this.baseService.removeById(id);
//        log.info("删除成功，删除的id为{}", id);
//        return new ResponseVo<>(RespUtils.respStrByBoolean(flag, "删除"));
//    }
//
//    @ApiOperation(value = "根据id查询接口", notes = "传入待查询id", produces = "application/json, application/xml", consumes = "application/json, application/xml")
//    @GetMapping("/findById")
//    @RequiresUser
//    public ResponseVo<CustomerPermission> findById(Integer id) {
//        if (id == null) {
//            Shift.fatal(RestStatusEnum.ID_NOTNULL);
//        }
//        return new ResponseVo<>(this.baseService.getById(id));
//    }
//
//    @ApiOperation(value = "查询所有", notes = "查询所有", produces = "application/json, application/xml", consumes = "application/json, application/xml")
//    @GetMapping("/findAll")
//    public ResponseVo<List<CustomerPermission>> findAll() {
//        return new ResponseVo<>(this.baseService.list());
//    }
//
//    @ApiOperation(value = "分页查询", notes = "分页查询", produces = "application/json, application/xml", consumes = "application/json, application/xml")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "size", value = "每页条数", required = true, dataType = "String", paramType = "query"),
//            @ApiImplicitParam(name = "current", value = "当前页数", required = true, dataType = "String", paramType = "query")
//    })
//    @GetMapping("/findPage")
//    public ResponseVo<IPage<CustomerPermission>> findPage(Page page) {
//        return new ResponseVo<>(this.baseService.page(page));
//    }
//
//}
//
